﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;

namespace MercuryFE
{
    public partial class ArgumentsEditor : Form
    {
        public string arguments { get; set; }


        public ArgumentsEditor(string currentArguments)
        {
            InitializeComponent();

            Dictionary<string, string> emulators = LauncherLib.getEmulatorPresets();

            foreach(KeyValuePair<string,string> emulator in emulators) {
                cmbEmulatorPresets.Items.Add(emulator);
            }
            cmbEmulatorPresets.DisplayMember = "Key";
            cmbEmulatorPresets.ValueMember = "Value";

            txtCommandLine.Text = currentArguments;
            

        }

        private void btnAddRom_Click(object sender, EventArgs e)
        {
            txtCommandLine.Text += "[rom]";
        }

        private void btnAddPath_Click(object sender, EventArgs e)
        {
            txtCommandLine.Text += "[path]";

        }

        private void btnAddFull_Click(object sender, EventArgs e)
        {
            txtCommandLine.Text += "[path]\\[rom].[ext]";
        }

        private void btnPopulate_Click(object sender, EventArgs e)
        {
            if (cmbEmulatorPresets.SelectedItem != null)
            {
                txtCommandLine.Text = ((KeyValuePair<string,string>)cmbEmulatorPresets.SelectedItem).Value.ToString();
            }
        }

        private void btnAddExt_Click(object sender, EventArgs e)
        {
            txtCommandLine.Text += "[ext]";
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            arguments = txtCommandLine.Text;
            this.Close();
        }
    }
}
